﻿using UnityEngine;
using System.Collections;

public class _Manha : MonoBehaviour {

	void Awake()
	{			
		this.gameObject.AddComponent("MeshRenderer");
		this.gameObject.AddComponent("MeshFilter");
		this.transform.Translate(-2.0f,0.7f,0.0f);	
	}
	int id = 76;
		
	void Start () 
	{		

		Mesh mesh = Quad.Create(0.8f, 0.9f);
		
		this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
		this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;
		
		this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
		{
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMin),
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMin)
		};
	}
	
	void Update () 
	{
	}
		
	void OnMouseEnter()
	{
		id = 93;
		Start();
	}
	
	void OnMouseExit()
	{
		id = 76;
		Start();
	}
	
		void OnMouseDown() 
		{
			Application.LoadLevel("Sinopse");
		}
	
}
